/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.gm.entities;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Med EL MOUDDENE
 */
@Entity
@Table(name = "reeducation_concernant_personne")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ReeducationConcernantPersonne.findAll", query = "SELECT r FROM ReeducationConcernantPersonne r"),
    @NamedQuery(name = "ReeducationConcernantPersonne.findByIdPersonne", query = "SELECT r FROM ReeducationConcernantPersonne r WHERE r.reeducationConcernantPersonnePK.idPersonne = :idPersonne"),
    @NamedQuery(name = "ReeducationConcernantPersonne.findByIdTypereeducation", query = "SELECT r FROM ReeducationConcernantPersonne r WHERE r.reeducationConcernantPersonnePK.idTypereeducation = :idTypereeducation")})
public class ReeducationConcernantPersonne implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected ReeducationConcernantPersonnePK reeducationConcernantPersonnePK;
    @Lob
    @Size(max = 65535)
    @Column(name = "DUREE_REED")
    private String dureeReed;
    @JoinColumn(name = "ID_PERSONNE", referencedColumnName = "ID_PERSONNE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Personne personne;
    @JoinColumn(name = "ID_TYPEREEDUCATION", referencedColumnName = "ID_TYPEREEDUCATION", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private TypeReeducation typeReeducation;

    public ReeducationConcernantPersonne() {
    }

    public ReeducationConcernantPersonne(ReeducationConcernantPersonnePK reeducationConcernantPersonnePK) {
        this.reeducationConcernantPersonnePK = reeducationConcernantPersonnePK;
    }

    public ReeducationConcernantPersonne(int idPersonne, int idTypereeducation) {
        this.reeducationConcernantPersonnePK = new ReeducationConcernantPersonnePK(idPersonne, idTypereeducation);
    }

    public ReeducationConcernantPersonnePK getReeducationConcernantPersonnePK() {
        return reeducationConcernantPersonnePK;
    }

    public void setReeducationConcernantPersonnePK(ReeducationConcernantPersonnePK reeducationConcernantPersonnePK) {
        this.reeducationConcernantPersonnePK = reeducationConcernantPersonnePK;
    }

    public String getDureeReed() {
        return dureeReed;
    }

    public void setDureeReed(String dureeReed) {
        this.dureeReed = dureeReed;
    }

    public Personne getPersonne() {
        return personne;
    }

    public void setPersonne(Personne personne) {
        this.personne = personne;
    }

    public TypeReeducation getTypeReeducation() {
        return typeReeducation;
    }

    public void setTypeReeducation(TypeReeducation typeReeducation) {
        this.typeReeducation = typeReeducation;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (reeducationConcernantPersonnePK != null ? reeducationConcernantPersonnePK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ReeducationConcernantPersonne)) {
            return false;
        }
        ReeducationConcernantPersonne other = (ReeducationConcernantPersonne) object;
        if ((this.reeducationConcernantPersonnePK == null && other.reeducationConcernantPersonnePK != null) || (this.reeducationConcernantPersonnePK != null && !this.reeducationConcernantPersonnePK.equals(other.reeducationConcernantPersonnePK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.gm.entities.ReeducationConcernantPersonne[ reeducationConcernantPersonnePK=" + reeducationConcernantPersonnePK + " ]";
    }
    
}
